#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int longestOnes(vector<int>& nums, int k) {
        int ret = 0, zero = 0, n = nums.size();
        int left = 0, right = 0;
        while (right < n) {
            right++;
            if (nums[right-1] == 0)
                zero++;
            while ( zero > k) {
                if (nums[left++] == 0)
                    zero--;
            }
            ret = std::max(ret, right - left);
        }
        return ret;
    }
};

int main()
{

	return 0;
}
